<?
   class log_user{
      var $logged = 0;
      var $login_name;
      var $password;
      var $use_email;
      var $use_phone;
      var $use_id;
   
      function log_user($login_name = "",$password=""){
		$this->logged = 0;
		if ($login_name==""){
			if (isset($_COOKIE["login_name"])) $login_name = $_COOKIE["login_name"];
		}
		if ($password==""){
			if (isset($_COOKIE["PHPSESS1D"])) $password = $_COOKIE["PHPSESS1D"];
		}
      $db_user = new db_query("SELECT *
                               FROM user_multi
                               WHERE use_name = '".$login_name."' and use_pass = '".$password."' and use_active = 1 ");
      if($row = mysql_fetch_array($db_user->result)){
         $this->logged     = 1;
         $this->login_name   = $login_name;
         $this->password   = $password;
         $this->use_email  = $row['use_email'];
         $this->use_phone  = $row['use_phone'];
         $this->use_id     = $row['use_id'];            
      }
      unset($db_user);
      }
      
      function savecookie($time){
         if($this->logged = 1){
			setcookie("login_name",$this->login_name,time()+$time,"/");
			setcookie("PHPSESS1D",$this->password,time()+$time,"/");
         }
      }
      
     	function logout(){
		$time = 1234;
		$this->login_name = "";
		$this->password	= "";
			setcookie("login_name",$this->login_name,time()+$time,"/");
			setcookie("PHPSESS1D",$this->password,time()+$time,"/");
		$_COOKIE["login_name"] = "";
		$_COOKIE["PHPSESS1D"] = "";
		//setcookie("u_id","",time()-200000);
		$this->logged=0;
	}
   }
?>